
//
//  HomeSectionHeaderView.m
//  pmm
//
//  Created by WTFSSD on 2017/7/27.
//  Copyright © 2017年 WTFSSD. All rights reserved.
//

#import "HomeSectionHeaderView.h"


@interface HomeSectionHeaderView()

@property(nonatomic,strong)UILabel * titleLabel;



@end

@implementation HomeSectionHeaderView


-(void)initSubView{
    UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    [self addSubview:titleLabel];
    self.titleLabel = titleLabel;
    titleLabel.font = [UIFont systemFontOfSize:14];
    titleLabel.textColor = RGB(95, 143, 242);
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    
    
    UIView * line1 = [[UIView alloc] initWithFrame:CGRectZero];
    UIView * line2 = [[UIView alloc] initWithFrame:CGRectZero];
    [self addSubview:line1];
    [self addSubview:line2];
    line1.backgroundColor =  RGB(95, 143, 242);
    line2.backgroundColor =  RGB(95, 143, 242);
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0.5);
        make.width.mas_equalTo(50);
        make.right.equalTo(titleLabel.mas_left).offset(-10);
        make.centerY.equalTo(self.mas_centerY);
    }];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(line1.mas_height);
        make.width.equalTo(line1.mas_width);
        make.left.equalTo(titleLabel.mas_right).offset(10);
        make.centerY.equalTo(self.mas_centerY);
    }];
}

-(void)setTitle:(NSString *)title{
    _title = title;
    self.titleLabel.text = title;
    [self.titleLabel sizeToFit];
    [self layoutIfNeeded];
}


@end
